<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">用户ID</label>
        <div class="layui-input-block">
            <input disabled name="id" lay-verify="required" lay-reqtext="" placeholder="" value="${param.id}" class="layui-input">
            <tip>商品id不能修改。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">用户名</label>
        <div class="layui-input-block">
            <input disabled name="username" lay-verify="required" lay-reqtext="" placeholder="" value="${param.username}" class="layui-input">
            <tip>用户的名称不能修改。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">用户密码</label>
        <div class="layui-input-block">
            <input disabled name="password" lay-verify="required" lay-reqtext="" placeholder="" value="${param.password}" class="layui-input">
            <tip>用户密码不能修改。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">用户管理权限</label>
        <div class="layui-input-block">
            <input type="text" name="user_manage" lay-verify="required" lay-reqtext="" placeholder="" value="${param.user_manage}" class="layui-input">
            <tip>开启权限输入为1，关闭权限输入为0。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">商品管理权限</label>
        <div class="layui-input-block">
            <input type="text" name="goods_manage" lay-verify="required" lay-reqtext="" placeholder="" value="${param.goods_manage}" class="layui-input">
            <tip>开启权限输入为1，关闭权限输入为0。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">入库权限</label>
        <div class="layui-input-block">
            <input type="text" name="indepot_manage" lay-verify="required" lay-reqtext="" placeholder="" value="${param.indepot_manage}" class="layui-input">
            <tip>开启权限输入为1，关闭权限输入为0。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">出库权限</label>
        <div class="layui-input-block">
            <input type="text" name="outdepot_manage" lay-verify="required" lay-reqtext="" placeholder="" value="${param.outdepot_manage}" class="layui-input">
            <tip>开启权限输入为1，关闭权限输入为0。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>
</div>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var index = layer.alert("用户名："+data.field.username+"<br>"+
                "用户密码："+data.field.password+"<br>"
                +"用户管理权限："+data.field.user_manage+"<br>"
                +"用户商品管理权限："+data.field.goods_manage+"<br>"
                +"用户入库管理权限："+data.field.indepot_manage+"<br>"
                +"用户出库管理权限："+data.field.outdepot_manage+"<br>", {
                title: '最终的提交信息'
            }, function () {

                $.post('/user_updatemanage',data.field,function(result) {
                    // console.log('前端输出的'+result1)
                    if(result.result){
                        layer.msg('修改成功');
                        // 关闭弹出层
                        layer.close(index);

                        var iframeIndex = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(iframeIndex);

                    }
                    else {
                        layer.msg('修改失败');
                    }
                });

            });

            return false;
        });

    });
</script>
</body>
</html>